package com.mygdx.game;

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.mygdx.game.stage.GameStage;
import com.mygdx.game.stage.MenuStage;
import com.mygdx.game.stage.StoreStage;

/**
 * 超级马丽
 * Created by 80002023 on 2016/8/3.
 */
public class SuperMarioTest extends Game {

    private GameStage gameStage;
    private MenuStage menuStage;
    private StoreStage storeStage;

    @Override
    public void create() {
        gameStage = new GameStage();
        menuStage = new MenuStage();
        storeStage = new StoreStage();
    }

    @Override
    public void render() {

        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        if(Constants.stageFlag == Constants.startStageOn){
            Gdx.input.setInputProcessor(menuStage);
            menuStage.act();
            menuStage.draw();
        }else if (Constants.stageFlag == Constants.gameStageOn) {
            Gdx.input.setInputProcessor(gameStage);
            gameStage.act();
            gameStage.draw();
        }else if (Constants.stageFlag == Constants.storeStageOn) {
            Gdx.input.setInputProcessor(storeStage);
            storeStage.act();
            storeStage.draw();
        }
    }

    @Override
    public void dispose() {
        gameStage.dispose();
        menuStage.dispose();
        storeStage.dispose();
    }
}
